// React基础组件
import React from 'react'
// dva 连接组件 - 连接route和model
import { connect } from 'dva'
// 引入antd的组件
import { Form,Col, Row } from 'antd'
//导入路由组件，用于跳转等
import { Link, hashHistory } from 'dva/router'
// 导入项目全局配置文件
import config from 'config/config'

// 引入model取值工具方法
import { mapStateToProps } from 'utils/view_utils'
// 当前组件样式
import styles from './evaluateDetailStyle.less'
//引用listPage
import ListPage from 'widget/PageTmpl/ListPage'
import cx from 'classnames'
/**
 * description 路由视图及事件处理
 * dispatch 分发到models中的effects对应事件名
 * model 用于获取models中state定义的数据
 * form 表单对象
 */
const evaluateDetailView = function({dispatch, model, form}) {
  // 表单的子函数
  const {resetFields, getFieldDecorator, validateFields, setFieldsValue} = form
  // 取出model对象，命名空间
  const { modelObj, namespace } = model

  // modelObj.xxx获取model中状态机的值
  let { areaList, businessIdList } = modelObj
  

  let pageProps = {
    // ---------- 界面部分 ----------
    ui: {
      // 页面接口地址
      api_url: "",
      // 接口方式
      method: "POST",
      // "data_field_name":"data",
      app: "",
      // 接口参数
      params: "",
      // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
      // "mockData": mockData,
      mockData: null,
      // 数据表格
      table:
        {
          status_params: "status=0",
          status_text: "全部",
          // 表头字段列表
          scroll: { x: 1000 },
          fields: [
            {
              en_name: "key",
              zh_name: "序号",
              width: "60",
              render: (a, item, index, d, e, f) => {
                return index+1
              },
            },
            {
              en_name: "title",
              zh_name: "评价事件",
                width:180
            },
            {
              en_name: "channel",
              zh_name: "评价人",
                width:120,
            },
            {
              en_name: "businessName",
              zh_name: "评价人手机号码",
              width:130,
            },
            {
              en_name: "persons",
              zh_name: "评价人评分",
                width:120
            },
            {
              en_name: "creator",
              zh_name: "评价标签",
            },
            {
              en_name: "createTime",
							zh_name: "评价内容",
							width:120
            },
            {
              en_name: "point",
							zh_name: "评价时间",
							width:180
            }
          ]
      }
    },
  }
  if (!!modelObj.biz) {
		pageProps.biz = modelObj.biz
		pageProps.biz.syncBackCbf = (biz) => {
			dispatch({
				type: `${namespace}/updateStore`,
				payload: { biz }
			})
		}
  }
  
  return (
    <div className={cx('pageLayout')}>
      <div className='public_listMain'>
        <div className="boxShadow" style={{ marginBottom: '16px' }}>
          <Row gutter={16}>
            <Col  span={6}>
              <div >所属项目：美的清风花园</div>
            </Col>
            <Col  span={6}>
              <div >顾问姓名：花犬</div>
            </Col>
            <Col  span={6}>
              <div >平均分：4.0分</div>
            </Col>
          </Row>
        </div>
        <ListPage pageProps={pageProps}/>
      </div>
    </div>
  )
}

// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(evaluateDetailView))
